<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 30px;
        height: 30px;
        background-color: #f00;
      }
      .active {
        width: 100px;
        height: 100px;
      }
    </style>
  </head>
  <body>
    <!-- v-bind：作用：绑定属性，修改属性的值 
                   语法：  v-bind:属性名=值
                        简写:   :属性名=值         
    -->
    <div id="app">
      <button @click="setClass">修改box的宽高</button>
      <div class="box" v-bind:class="str">1223</div>
      <button @click="setImgSrc">点击后显示图片</button>
      <img v-bind:src="imgSrc" :xxx="xxxVal" alt="" />
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          str: '',
          imgSrc: '',
          xxxVal: 123
        },
        methods: {
          setClass () {
            this.str = 'active'
          },
          setImgSrc () {
            this.xxxVal = Math.random() * 999
            this.imgSrc =
              'https://www.baidu.com/img/flexible/logo/pc/index_gray.png'
          }
        }
      })
    </script>
  </body>
</html>
